package com.ssm.pre.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ssm.pre.service.FamilyService;
import com.ssm.util.object.InputObject;
import com.ssm.util.object.OutputObject;

@Controller
public class FamilyController {
	
	@Autowired
	private FamilyService familyService;
	
	/**
	 * 查询住户信息
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/FamilyController/queryFamilyList")
	@ResponseBody
	public void queryFamilyList(InputObject inputObject ,OutputObject outputObject) throws Exception{
		familyService.queryFamilyList(inputObject, outputObject);
	}
	/**
	 * 删除住户信息
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/FamilyController/deleteFamilyById")
	@ResponseBody
	public void deleteFamilyById(InputObject inputObject ,OutputObject outputObject) throws Exception{
		familyService.deleteFamilyById(inputObject, outputObject);
	}
	
	
	/**
	 * 查询一条住户信息
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/FamilyController/queryFamilyOneById")
	@ResponseBody
	public void queryFamilyOneById(InputObject inputObject ,OutputObject outputObject) throws Exception{
		familyService.queryFamilyOneById(inputObject, outputObject);
	}
	
	/**
	 * 修改审核状态
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/FamilyController/editFamily")
	@ResponseBody
	public void editFamily(InputObject inputObject ,OutputObject outputObject) throws Exception{
		familyService.editFamily(inputObject, outputObject);
	}
	
	/**
	 * 微信端增加住户信息
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/gateway/FamilyController/addWechatFamily")
	@ResponseBody
	public void addWechatFamily(InputObject inputObject ,OutputObject outputObject) throws Exception{
		familyService.addWechatFamily(inputObject, outputObject);
	}
	/**
	 * 微信端获取openId，检查审核状态是否通过
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/gateway/FamilyController/getWechatOpenId")
	@ResponseBody
	public synchronized void getWechatOpenId(InputObject inputObject ,OutputObject outputObject) throws Exception{
		familyService.getWechatOpenId(inputObject, outputObject);
	}
	
	/**
	 * 获取session中的信息
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/gateway/FamilyController/queryFamilyBySession")
	@ResponseBody
	public void queryFamilyBySession(InputObject inputObject ,OutputObject outputObject) throws Exception{
		familyService.queryFamilyBySession(inputObject, outputObject);
	}
}
